package org.aplombh.java.utils;

import java.util.Collection;
import java.util.Iterator;

public
class Queue<T> implements java.util.Queue<T> {

    private static final int N = 100010;
    T[] queue;
    int head;
    int tail;
    int size;

    public Queue() {
        init();
    }

    public void init() {
        if (queue == null)
            queue = (T[]) new Object[N];
        tail = -1;
        head = 0;
        size = 0;
    }

    @Override
    public int size() {
        return size;
    }

    @Override
    public boolean isEmpty() {
        return tail < head;
    }

    @Override
    public boolean contains(Object o) {
        boolean flag = false;
        for (int i = tail; i <= head; i++) {
            if (queue[i].equals(o))
                flag = true;
        }
        return flag;
    }

    @Override
    public Iterator<T> iterator() {
        return null;
    }

    @Override
    public Object[] toArray() {
        return new Object[0];
    }

    @Override
    public <T1> T1[] toArray(T1[] a) {
        return null;
    }

    @Override
    public boolean add(T t) {
        queue[++tail] = t;
        size++;
        return true;
    }

    public boolean push(T t) {
        queue[++tail] = t;
        size++;
        return true;
    }

    @Override
    public boolean remove(Object o) {
        return false;
    }

    @Override
    public boolean containsAll(Collection<?> c) {
        return false;
    }

    @Override
    public boolean addAll(Collection<? extends T> c) {
        return false;
    }

    @Override
    public boolean removeAll(Collection<?> c) {
        return false;
    }

    @Override
    public boolean retainAll(Collection<?> c) {
        return false;
    }

    @Override
    public void clear() {

    }

    @Override
    public boolean offer(T t) {
        return false;
    }

    @Override
    public T remove() {
        size--;
        return queue[head++];
    }

    public T pop() {
        size--;
        return queue[head++];
    }

    @Override
    public T poll() {
        return null;
    }

    @Override
    public T element() {
        return null;
    }

    @Override
    public T peek() {
        return queue[head];
    }

    public T front() {
        return queue[head];
    }

}